<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">

    <link href="/bootstraptable/bootstrap-table.min.css" rel="stylesheet">
</head>
<body>
<div style="color: #0d8ddb">您正在做的业务是:生产管理--产品生产工序设计--制定产品生产工序设计单</div>
<div class="container">
    <!--查询条件面板-->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3>查询条件</h3>
        </div>
        <div class="panel-body">
            <form class="" action="" id="design_form">
                <div class="form-group">
                    <label>请选择产品I级分类：</label>
                    <select class="form-control" name="search_firstKindId" id="search_firstKindId">
                        <option value="">--请选择--</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>请选择产品II级分类：</label>
                    <select class="form-control" name="search_secondKindId" id="search_secondKindId">
                        <option value="">--请选择--</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>请选择产品III级分类：</label>
                    <select class="form-control" name="search_thirdKindId" id="search_thirdKindId">
                        <option value="">--请选择--</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>请输入建档时间：</label>
                    <input type="date" class="form-control" name="search_registerTime1" id="search_registerTime1">--
                    <input type="date" class="form-control" name="search_registerTime2" id="search_registerTime2">(YYYY-MM-DD)
                </div>
                <input type="button" id="search_btn" value="查询" class="btn btn-primary btn-sm"/>
            </form>
        </div>
    </div>
    <table id="details_file_table"></table>
</div>
<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="/js/hAdmin.js?v=4.1.0"></script>
<!--<script type="text/javascript" src="/js/index.js"></script>-->

<!-- 第三方插件 -->
<script src="/js/plugins/pace/pace.min.js"></script>

<!--BootstrapTable-->
<script src="/bootstraptable/bootstrap-table.min.js"></script>
<script src="/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
   $(function (){
       aa()
       bb()
       cc()
       $("#details_file_table").bootstrapTable({
           // 请求方式
           method: "post",
           // 内容类型：如果请求方式是post，内容类型必须是application/x-www-form-urlencoded
           contentType: "application/x-www-form-urlencoded",
           // 请求路径
           url: '/design/designFileUnMakeList1',
           // 数据行交替样式
           striped: true,
           // 是否是服务器端分页：server表示服务器端，client表示前端分页
           sidePagination: 'server',
           //初始化加载第一页
           pageNumber: 1,
           //是否分页
           pagination: true,
           // 单页记录数，页大小
           pageSize: 5,
           // 分页列表
           pageList: [5, 10, 20],
           //  刷新按钮
           // showRefresh:true,
           //   请求参数
           queryParams: function (params) {
               let obj = {
                   // params.limit获取组件中的页大小
                   // params.offset获取请求数据的起始索引
                   pageSize: params.limit,
                   pageNo: (params.offset / params.limit) + 1,
                   search_firstKindId: $("#design_module_form #search_firstKindId").val(),
                   search_secondKindId: $("#design_module_form #search_secondKindId").val(),
                   search_thirdKindId: $("#design_module_form #search_thirdKindId").val(),
                   search_registerTime1: $("#design_module_form #search_registerTime1").val(),
                   search_registerTime2: $("#design_module_form #search_registerTime2").val()
               }
               return obj;
           },
           columns: [{
               title: "产品编号",
               field: "productId",
               formatter: function (value, row, index) {
                   let html = `<a href="javascript:changpin(${row.productId})">${value}</a>`
                   return html
               }
           }, {
               title: "产品名称",
               field: "productName",
           }, {
               title: "档次级别",
               field: "type",
               formatter: function (value, row, index) {
                   if (row.type === "Y001-1")
                       return "商品"
                   else
                       return "物料"
               }
           }, {
               title: "I级分类",
               field: "firstKindName",

           }, {
               title: "II级分类",
               field: "secondKindName",

           }, {
               title: "III级分类",
               field: "thirdKindName",

           }, {
               title: "产品经理",
               field: "responsiblePerson",

           }, {
               title: "制定设计单",
               field: "",
               formatter:function(value, row, index){
                   let a="<a href='javascript:edit("+row.id+")'>制定设计单</a>"
                   return a;
               }

           }]
       })

   })
   function changpin(pa){
       localStorage.setItem("changpin",pa)
       location.href="/design/design_file_dengji3UI"
   }
   function edit(id){
       localStorage.setItem("id3",id);
       location.href="/produce/module_design_procedure_addUI"
   }
   function aa() {
       $.post("/DesignConflgFileKind/List", {"num": "1"}, function (res) {
           console.log(res)
           $("#design_module_unmake_list_form #search_firstKindId option:gt(0)").remove()
           for (let i = 0; i < res.length; i++) {
               let ary_object = res[i]
               let $option = $("<option>" + ary_object.kindName + "</option>")
               $option.val(ary_object.kindId)
               $("#search_firstKindId").append($option)
           }
       })
   }

   function bb() {
       $.post("/DesignConflgFileKind/List", {"num": "2"}, function (res) {
           console.log(res)
           $("#design_module_unmake_list_form #search_secondKindId option:gt(0)").remove()
           for (let i = 0; i < res.length; i++) {
               let ary_object = res[i]
               let $option = $("<option>" + ary_object.kindName + "</option>")
               $option.val(ary_object.kindId)
               $("#search_secondKindId").append($option)
           }
       })
   }

   function cc() {
       $.post("/DesignConflgFileKind/List", {"num": "3"}, function (res) {
           console.log(res)
           $("#design_module_unmake_list_form #search_thirdKindId option:gt(0)").remove()
           for (let i = 0; i < res.length; i++) {
               let ary_object = res[i]
               let $option = $("<option>" + ary_object.kindName + "</option>")
               $option.val(ary_object.kindId)
               $("#search_thirdKindId").append($option)
           }
       })
   }
</script>
</body>
</html>